<?php

namespace App\Http\Controllers;

use App\Answer;
use Illuminate\Http\Request;

class AnswerController extends Controller
{
    public function index()
    {
        $answers = Answer::latest('created_at')->Paginate(8);
        return view('Master.answers',compact('answers'));
    }

    public function destroy($id)
    {
        Answer::destroy($id);
        session()->flash('success', '删除成功');
        return redirect()->route('answers.index');
    }
}
